package engine;

public class ROB {
	int length;
	public int tail;
	public int head;
	public ROBEntry[] entries;
	public boolean[] valid;
	public ROB(int n) {
		length=n;
		head=0;
		tail=0;
		entries=new ROBEntry[n];
		valid=new boolean[n];
	}
	public int addEntry(String type, String Dest,int reservationStation) {
		//if(valid[tail]) return false;
		int num=tail;
		entries[tail]=new ROBEntry(tail, type, Dest,reservationStation);
		valid[tail]=true;
		tail=(tail+1)%length;
		return num;
	}
	public ROBEntry getEntry() {
		int temphead=head;
		head=(head+1)%length;
		valid[temphead]=false;
		return entries[temphead];
	}
	public ROBEntry peekEntry() {
		return entries[head];
	}
	//public boolean isThere
}
